import http from "../plugins/http";

const serviceApi = {};

serviceApi.getToken = function(params) {
  return http.post({
    url: "./rest/auth/oauth/token",
    headers: {
      anonymous: true
    },
    params: params
  });
};

serviceApi.getFunc = function() {
  return http.get({
    url: "./rest/app/api/v1/func"
  });
};

serviceApi.getOpenId = function(params) {
  return http.get({
    url: "./rest/app/api/v1/essc/pay/openid",
    params: params
  });
};

serviceApi.getSSCInfo = function(params) {
  return http.get({
    url: "./rest/app/api/v1/essc/sign/info",
    params: params
  });
};

serviceApi.getScene = function() {
  return http.get({
    url: "./rest/app/api/v1/scene"
  });
};

serviceApi.getCard = function() {
  return http.get({
    url: "./rest/app/api/v1/card/all"
  });
};

serviceApi.bindCard = function(obj) {
  return http.post({
    url: "./rest/app/api/v1/card/bind",
    data: obj
  });
};

serviceApi.getVoucher = function(params) {
  return http.get({
    url: "./rest/app/api/v1/card/my",
    params: params
  });
};

serviceApi.obtainRecord = function(params, url) {
  return http.get({
    url: "./rest/app/api/v1/notice/" + url,
    params: params
  });
};

serviceApi.obtainMsg = function(params) {
  return http.get({
    url: "./rest/app/api/v1/notice/msg",
    params: params
  });
};

serviceApi.obtainId = function(params) {
  return http.getAnonymous({
    url: "./rest/auth/api/host/info",
    params: params
  });
};

serviceApi.obtainFuncDetail = function(data) {
  return http.get({
    url: "./rest/app/api/v1/func/" + data + "/info"
  });
};

serviceApi.analysisData = function(data) {
  return http.get({
    url: "./rest/app/api/v1/login/auth/sign/str?" + data
  });
};

serviceApi.msgTemplate = function(data) {
  return http.get({
    url: "./rest/app/api/v1/message/" + data
  });
};

serviceApi.banner = function() {
  return http.get({
    url: "./rest/app/api/v1/banner"
  });
};

export default serviceApi;
